home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / gfx / show / gs_src_gs.lha / gs5.03 / gxchar.h < prev    next >
C/C++ Source or Header  |  1997-02-17  |  6KB  |  156 lines

  1. /* Copyright (C) 1989, 1995, 1997 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gxchar.h */
  20. /* Internal character definition for Ghostscript library */
  21. /* Requires gsmatrix.h, gxfixed.h */
  22. #include "gschar.h"
  23.  
  24. /* The type of cached characters is opaque. */
  25. #ifndef cached_char_DEFINED
  26. #  define cached_char_DEFINED
  27. typedef struct cached_char_s cached_char;
  28. #endif
  29.  
  30. /* The type of cached font/matrix pairs is opaque. */
  31. #ifndef cached_fm_pair_DEFINED
  32. #  define cached_fm_pair_DEFINED
  33. typedef struct cached_fm_pair_s cached_fm_pair;
  34. #endif
  35.  
  36. /* The type of font objects is opaque. */
  37. #ifndef gs_font_DEFINED
  38. #  define gs_font_DEFINED
  39. typedef struct gs_font_s gs_font;
  40. #endif
  41.  
  42. /* The types of memory and null devices may be opaque. */
  43. #ifndef gx_device_memory_DEFINED
  44. #  define gx_device_memory_DEFINED
  45. typedef struct gx_device_memory_s gx_device_memory;
  46. #endif
  47. #ifndef gx_device_null_DEFINED
  48. #  define gx_device_null_DEFINED
  49. typedef struct gx_device_null_s gx_device_null;
  50. #endif
  51.  
  52. /*
  53.  * Define the stack for composite fonts.
  54.  * If the current font is not composite, depth = -1.
  55.  * If the current font is composite, 0 <= depth <= max_font_depth.
  56.  * items[0] through items[depth] are occupied.
  57.  * items[0].font is the root font; items[0].index = 0.
  58.  * The root font must be composite, but may be of any map type.
  59.  * items[0..N-1] are modal composite fonts, for some N <= depth.
  60.  * items[N..depth-1] are non-modal composite fonts.
  61.  * items[depth] is a base (non-composite) font.
  62.  * Note that if depth >= 0, the font member of the graphics state
  63.  * for a base font BuildChar/Glyph is the same as items[depth].font.
  64.  */
  65. #define max_font_depth 5
  66. typedef struct gx_font_stack_item_s {
  67.     gs_font *font;        /* font at this level */
  68.     uint index;        /* index of this font in parent's */
  69.                 /* Encoding */
  70. } gx_font_stack_item;
  71. typedef struct gx_font_stack_s {
  72.     int depth;
  73.     gx_font_stack_item items[1 + max_font_depth];
  74. } gx_font_stack;
  75.  
  76. /* An enumeration object for string display. */
  77. typedef enum {
  78.     sws_none,
  79.     sws_cache,            /* setcachedevice[2] */
  80.     sws_no_cache,            /* setcharwidth */
  81.     sws_cache_width_only        /* setcharwidth for xfont char */
  82. } show_width_status;
  83. struct gs_show_enum_s {
  84.     /* Following are set at creation time */
  85.     gs_state *pgs;
  86.     int level;            /* save the level of pgs */
  87.     gs_const_string str;
  88.     float wcx, wcy;            /* for widthshow */
  89.     gs_char wchr;            /* ditto */
  90.     float ax, ay;            /* for ashow */
  91.     bool add;            /* true if a[width]show */
  92.     int do_kern;            /* 1 if kshow, -1 if [x][y]show */
  93.                     /* or cshow, 0 otherwise */
  94.     bool slow_show;            /* [a][width]show or kshow or */
  95.                     /* [x][y]show or cshow */
  96.     gs_char_path_mode charpath_flag;
  97.     gs_state *show_gstate;        /* for setting pgs->show_gstate */
  98.                     /* at returns/callouts */
  99.     int stringwidth_flag;        /* 0 for show/charpath, */
  100.                     /* 1 for stringwidth, */
  101.                     /* -1 for cshow */
  102.     int can_cache;            /* -1 if can't use cache at all, */
  103.                     /* 0 if can read but not load, */
  104.                     /* 1 if can read and load */
  105.     gs_int_rect ibox;        /* int version of quick-check */
  106.                     /* (inner) clipping box */
  107.     gs_int_rect obox;        /* int version of (outer) clip box */
  108.     int ftx, fty;            /* transformed font translation */
  109.     /* Following are updated dynamically */
  110.     gs_glyph (*encode_char)(P3(gs_show_enum *, gs_font *, gs_char *));
  111.                     /* copied from font, */
  112.                     /* except for glyphshow */
  113.     gs_log2_scale_point log2_suggested_scale; /* suggested scaling */
  114.                     /* factors for oversampling, */
  115.                     /* based on FontBBox and CTM */
  116.     gx_device_memory *dev_cache;    /* cache device */
  117.     gx_device_memory *dev_cache2;    /* underlying alpha memory device, */
  118.                     /* if dev_cache is an alpha buffer */
  119.     gx_device_null *dev_null;    /* null device for stringwidth */
  120.     uint index;            /* index within string */
  121.     gs_char current_char;        /* current char for render or move */
  122.     gs_glyph current_glyph;        /* current glyph ditto */
  123.     gs_fixed_point wxy;        /* width of current char */
  124.                     /* in device coords */
  125.     gs_fixed_point origin;        /* unrounded origin of current char */
  126.                     /* in device coords, needed for */
  127.                     /* charpath and WMode=1 */
  128.     cached_char *cc;        /* being accumulated */
  129.     gs_point width;            /* total width of string, set at end */
  130.     show_width_status width_status;
  131.     gs_log2_scale_point log2_current_scale;
  132.     gx_font_stack fstack;
  133.     int (*continue_proc)(P1(gs_show_enum *));    /* continuation procedure */
  134. };
  135. #define gs_show_enum_s_DEFINED
  136. #define private_st_gs_show_enum() /* in gschar.c */\
  137.   gs_private_st_composite(st_gs_show_enum, gs_show_enum, "gs_show_enum",\
  138.     show_enum_enum_ptrs, show_enum_reloc_ptrs)
  139.  
  140. /* Cached character procedures (in gxccache.c and gxccman.c) */
  141. #ifndef gs_font_dir_DEFINED
  142. #  define gs_font_dir_DEFINED    
  143. typedef struct gs_font_dir_s gs_font_dir;
  144. #endif
  145. cached_char *
  146.     gx_alloc_char_bits(P7(gs_font_dir *, gx_device_memory *, gx_device_memory *, ushort, ushort, const gs_log2_scale_point *, int));
  147. void gx_open_cache_device(P2(gx_device_memory *, cached_char *));
  148. void gx_free_cached_char(P2(gs_font_dir *, cached_char *));
  149. void gx_add_cached_char(P5(gs_font_dir *, gx_device_memory *, cached_char *, cached_fm_pair *, const gs_log2_scale_point *));
  150. void gx_add_char_bits(P3(gs_font_dir *, cached_char *, const gs_log2_scale_point *));
  151. cached_char *
  152.     gx_lookup_cached_char(P5(const gs_font *, const cached_fm_pair *, gs_glyph, int, int));
  153. cached_char *
  154.     gx_lookup_xfont_char(P6(const gs_state *, cached_fm_pair *, gs_char, gs_glyph, const gx_xfont_callbacks *, int));
  155. int gx_image_cached_char(P2(gs_show_enum *, cached_char *));
  156.